function [points, weights] = gauss_lengdre_loc(V, int_type)
[gauss_points_ref, gauss_weights_ref] = gauss_lengdre_ref(int_type);
if 2 == size(V,1)
    AB = [V(2,1)-V(1,1); V(2,2)-V(1,2)];
    points = [V(1,1)+0.5*(gauss_points_ref+1)*(V(2,1)-V(1,1)); V(1,2)+0.5*(gauss_points_ref+1)*(V(2,2)-V(1,2))]';
    weights = 0.5*norm(AB)*gauss_weights_ref;
elseif 3 == size(V,1)
    Jacobi = [V(2,:)-V(1,:); V(3,:)-V(1,:)]';
    J_det = det(Jacobi);
    weights = abs(J_det) * gauss_weights_ref;
    points(:,1) = V(1,1) + Jacobi(1,1)*gauss_points_ref(:,1) + Jacobi(1,2)*gauss_points_ref(:,2);
    points(:,2) = V(1,2) + Jacobi(2,1)*gauss_points_ref(:,1) + Jacobi(2,2)*gauss_points_ref(:,2);
end
end

%% gauss_lengdre_ref
function [points, weights] = gauss_lengdre_ref(int_type)
switch int_type
    case "1d"
        points = [-0.9681602395076260898355762, -0.8360311073266357942994298, -0.6133714327005903973087020, -0.3242534234038089290385380, 0, 0.3242534234038089290385380, 0.6133714327005903973087020, 0.8360311073266357942994298, 0.9681602395076260898355762];
        weights = [0.0812743883615744119718922, 0.1806481606948574040584720, 0.2606106964029354623187429, 0.3123470770400028400686304, 0.3302393550012597631645251, 0.3123470770400028400686304, 0.2606106964029354623187429, 0.1806481606948574040584720, 0.0812743883615744119718922];
    case "2d"
        points = [0.11270166537925829786104259255808, 0.1;
            0.11270166537925829786104259255808, 0.44364916731037085106947870372096;
            0.11270166537925829786104259255808, 0.78729833462074172434341789994505;
            0.5, 0.056350832689629148930521296279039;
            0.5, 0.25;
            0.5, 0.44364916731037085106947870372096;
            0.88729833462074170213895740744192, 0.01270166537925830792243875322356;
            0.88729833462074170213895740744192, 0.056350832689629148930521296279039;
            0.88729833462074170213895740744192, 0.1];
        weights = [0.068464377671353521259689500766399, 0.10954300427416563401550320122624, 0.068464377671353521259689500766399, 0.061728395061728395061728395061728, 0.098765432098765432098765432098765, 0.061728395061728395061728395061728, 0.0086961161558069665494796751659123, 0.013913785849291147520001565851544, 0.0086961161558069665494796751659123];
    otherwise
        error("Invalid integration type.");
end
end